<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    #########################################################################################
    # Programmer : nawattapon yoskamtorn						    #
    # Email	: contact@nawattapon.com						    #
    # Website	: http://www.nawattapon.com						    #
    #########################################################################################

    class Skill_Model extends Initmodel
    {
	function lists($p=1,$limit=50,$status=FALSE,$order=FALSE)
	{
	    $start = ($p-1)*$limit;
	    
	    if($status){
		$this->db->where('s_active', $status); 
	    }
	    
	    if($order){
		foreach($order as $key=>$val){
		    $this->db->order_by($key, $val); 
		}
	    }
	    
	    $query = $this->db->get('skills',$limit,$start);
	    return $query->result_array();
	}
	
	function get_all($status=FALSE)
	{
	    if($status){
		$this->db->where('s_active', $status); 
	    }
	    
	    $query = $this->db->get('skills');
	    return $query->result_array();
	}
	
	function count_all($status=FALSE)
	{
	    if($status){
		$this->db->where('s_active', $status); 
	    }
	    
	    return $query->num_rows();
	}
	
	function get_info($id=FALSE)
	{
	    if($id){
		$query = $this->db->get_where('mytable', array('s_id' => $id), 1);
		return $query->result_array();
	    }
	    
	    return FALSE;
	}
    }